<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const xhr = new XMLHttpRequest();
  xhr.open("get", "http://10.11.50.46:3000/login123?username=admin&password=123456");

  // xhr.timeout = 40;

  xhr.send();

  // xhr.onreadystatechange = function(){
  //   console.log(xhr.readyState)
  // }

  xhr.onload = function(){
    // console.log(xhr.readyState)
    if(xhr.status === 200){
      console.log(xhr.responseText)
    }
  }

  xhr.ontimeout = function(){
    console.log("超时了")
  }

  xhr.onabort = function(){
    console.log("请求被中断");
  }

  setTimeout(()=>{
    xhr.abort();
  }, 30);

  xhr.onerror = function(){
    console.log("出错了", xhr.status)
  }
  
</script>
</html>